{extend name='common/container'}
{block name="content"}
<div style="margin:0 15px 15px 15px;">
<el-card shadow="never" class="card" style="min-height:650px;">
	<el-form size="small" ref="form" :model="form" :rules="rules" label-width="130px" >
	<el-tabs v-model="activeName">
		<el-tab-pane style="padding-top:10px"  label="基本信息" name="基本信息">
				<el-row >
					<el-col :span="24">
						<el-form-item label="站点名称" prop="site_title">
							<el-input  v-model="form.site_title" autoComplete="off" clearable  placeholder="请输入站点名称"></el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="站点logo" prop="logo">
							<Upload size="small"      file_type="image" :image.sync="form.logo"></Upload>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="站点关键词" prop="keyword">
							<Tag :tag_list.sync="form.keyword"></Tag>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="官方邮箱" prop="system_mailbox">
							<el-input  v-model="form.system_mailbox" autoComplete="off" clearable  placeholder="请输入官方邮箱"></el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="站点描述" prop="descrip">
							<el-input  type="textarea" autoComplete="off" v-model="form.descrip"  :autosize="{ minRows: 2, maxRows: 4}" clearable placeholder="请输入站点描述"/>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="站点版权" prop="copyright">
							<el-input  v-model="form.copyright" autoComplete="off" clearable  placeholder="请输入站点版权"></el-input>
						</el-form-item>
					</el-col>
				</el-row>
                <el-row >
                    <el-col :span="24">
                        <el-form-item label="首页矩阵介绍" prop="matrix_introduction">
                            <wang-editor  :wangcontent.sync="form.matrix_introduction"></wang-editor>
                        </el-form-item>
                    </el-col>
                </el-row>
		</el-tab-pane>
		<el-tab-pane style="padding-top:10px;" v-if="files" label="拓展信息" name="拓展信息">
				<el-row >
					<el-col :span="24">
						<el-form-item label="上传配置" prop="filesize">
							<el-input  v-model="form.filesize" autoComplete="off" clearable  placeholder="请输入上传配置"></el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="文件类型" prop="filetype">
							<el-input  v-model="form.filetype" autoComplete="off" clearable  placeholder="请输入文件类型"></el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="水印状态" prop="water_status">
							<el-radio-group v-model="form.water_status">
								<el-radio :label="'1'">正常</el-radio>
								<el-radio :label="'0'">禁用</el-radio>
							</el-radio-group>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="水印位置" prop="water_position">
							<el-select style="width:100%" v-model="form.water_position" filterable clearable placeholder="请选择水印位置">
								<el-option key="0" label="左上角水印" :value="'1'"></el-option>
								<el-option key="1" label="上居中水印" :value="'2'"></el-option>
								<el-option key="2" label="右上角水印" :value="'3'"></el-option>
								<el-option key="3" label="左居中水印" :value="'4'"></el-option>
								<el-option key="4" label="居中水印" :value="'5'"></el-option>
								<el-option key="5" label="右居中水印" :value="'6'"></el-option>
								<el-option key="6" label="左下角水印" :value="'7'"></el-option>
								<el-option key="7" label="下居中水印" :value="'8'"></el-option>
								<el-option key="8" label="右下角水印" :value="'9'"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="水印透明度" prop="water_alpha">
							<el-slider v-model="form.water_alpha"></el-slider>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="绑定域名" prop="domain">
							<el-input  v-model="form.domain" autoComplete="off" clearable  placeholder="请输入绑定域名"></el-input>
						</el-form-item>
					</el-col>
				</el-row>
		</el-tab-pane>
		<el-tab-pane style="padding-top:10px"  label="矩阵设置" name="矩阵设置" v-if='isShow'>
			<el-row >
				<el-col :span="24">
					<el-form-item label="奖励点倍数" prop="bonus_multiple">
						<el-input type="number" v-model="form.bonus_multiple" autoComplete="off" clearable  placeholder="请输入倍数"></el-input>
						<small style="color: rgb(192, 196, 204);">参与矩阵,返回参与数量倍数的奖励点(假设2倍 例:参与100U,返200奖励点)</small>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row >
				<el-col :span="24">
					<el-form-item label="参与矩阵金额倍数" prop="participate_multiple">
						<el-input type="number" v-model="form.participate_multiple" autoComplete="off" clearable  placeholder="请输入数字"></el-input>
						<small style="color: #C0C4CC">用户参与矩阵的数量必须是n的倍数</small>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row >
				<el-col :span="24">
					<el-form-item label="最低参与金额" prop="participate_num">
						<el-input type="number" v-model="form.participate_num" autoComplete="off" clearable  placeholder="请输入数字"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row >
				<el-col :span="24">
					<el-form-item label="购买者分红点奖励(%):" prop="bonus_party">
						<el-input type="number" v-model="form.bonus_party" autoComplete="off" clearable  placeholder="请输入百分比"></el-input>
						<small style="color: rgb(192, 196, 204);">参与矩阵,获得分红点(假设100% 例:参与100U,获得100分红点)</small>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row >
				<el-col :span="24">
					<el-form-item label="直推分红点奖励(%):" prop="bonus_superior">
						<el-input type="number" v-model="form.bonus_superior" autoComplete="off" clearable  placeholder="请输入百分比"></el-input>
						<small style="color: rgb(192, 196, 204);">下级参与矩阵,获得分红点(假设20% 例:参与100U,获得20分红点)</small>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row >
				<el-col :span="24">
					<el-form-item label="间推分红点奖励(%):" prop="bonus_indirect">
						<el-input type="number" v-model="form.bonus_indirect" autoComplete="off" clearable  placeholder="请输入百分比"></el-input>
						<small style="color: rgb(192, 196, 204);">下下级参与矩阵,获得分红点(假设20% 例:参与100U,获得20分红点)</small>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row >
				<el-col :span="24">
					<el-form-item label="静态释放 %" prop="static_release">
						<el-input type="number" v-model="form.static_release" autoComplete="off" clearable  placeholder="请输入数字"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row >
				<el-col :span="24">
					<el-form-item label="动态释放 %" prop="dynamic_release">
						<el-input type="number" v-model="form.dynamic_release" autoComplete="off" clearable  placeholder="请输入数字"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row >
				<el-col :span="24">
					<el-form-item label="矩阵团队极差" prop="team_range_status">
						<el-switch v-model="form.team_range_status" active-color="#13ce66" inactive-color="#ff4949" active-value="1" inactive-value="0"></el-switch>
					</el-form-item>
				</el-col>
			</el-row>
		</el-tab-pane>
		<el-tab-pane style="padding-top:10px"  label="财务设置" name="财务设置">
			<el-row>
				<el-col :span="24">
					<el-form-item label="剩余可释放LP" prop="release_lp">
						<el-input type="number" v-model="form.release_lp" autoComplete="off" clearable  placeholder="请输入数字"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row >
				<el-col :span="24">
					<el-form-item label="U提现手续费类型" prop="withdrawal_money_type">
						<el-radio-group v-model="form.withdrawal_money_type">
							<el-radio :label="'1'">百分比</el-radio>
							<el-radio :label="'2'">固定值</el-radio>
						</el-radio-group>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="24">
					<el-form-item label="U提现手续费" prop="withdrawal_money">
						<el-input type="number" v-model="form.withdrawal_money" autoComplete="off" clearable  placeholder="请输入数字"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="24">
					<el-form-item label="最低提现金额" prop="min_withdrawal">
						<el-input type="number" v-model="form.min_withdrawal" autoComplete="off" clearable  placeholder="请输入数字"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row >
				<el-col :span="24">
					<el-form-item label="U转账手续费类型" prop="accounts_withdrawal_type">
						<el-radio-group v-model="form.accounts_withdrawal_type">
							<el-radio :label="'1'">百分比</el-radio>
							<el-radio :label="'2'">固定值</el-radio>
						</el-radio-group>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row >
				<el-col :span="24">
					<el-form-item label="转账手续费" prop="accounts_withdrawal">
						<el-input type="number" v-model="form.accounts_withdrawal" autoComplete="off" clearable  placeholder="请输入数字"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row >
				<el-col :span="24">
					<el-form-item label="最低转账金额" prop="min_accounts">
						<el-input type="number" v-model="form.min_accounts" autoComplete="off" clearable  placeholder="请输入数字"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row >
				<el-col :span="24">
					<el-form-item label="注册代币奖励" prop="register_cid">
						<el-select style="width:100%" v-model="form.register_cid" filterable clearable placeholder="请选择奖励代币">
							<el-option v-for="(item,i) in currency" :key="i" :label="item.name" :value="item.id"></el-option>
						</el-select>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row >
				<el-col :span="24">
					<el-form-item label="注册代币奖励数量" prop="register_num">
						<el-input type="number" v-model="form.register_num" autoComplete="off" clearable  placeholder="请输入数字"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
<!--			<el-row >-->
<!--				<el-col :span="24">-->
<!--					<el-form-item label="质押代币" prop="pledge_cid">-->
<!--						<el-select style="width:100%" v-model="form.pledge_cid" filterable clearable placeholder="请选择质押代币">-->
<!--							<el-option v-for="(item,i) in currency" :key="i" :label="item.name" :value="item.id"></el-option>-->
<!--						</el-select>-->
<!--					</el-form-item>-->
<!--				</el-col>-->
<!--			</el-row>-->
<!--			<el-row >-->
<!--				<el-col :span="24">-->
<!--					<el-form-item label="质押释放代币" prop="pledge_release_cid">-->
<!--						<el-select style="width:100%" v-model="form.pledge_release_cid" filterable clearable placeholder="请选择质押释放代币">-->
<!--							<el-option v-for="(item,i) in currency" :key="i" :label="item.name" :value="item.id"></el-option>-->
<!--						</el-select>-->
<!--					</el-form-item>-->
<!--				</el-col>-->
<!--			</el-row>-->
<!--			<el-row >-->
<!--				<el-col :span="24">-->
<!--					<el-form-item label="每日质押奖励比例(%)" prop="pledge_num">-->
<!--						<el-input type="number" v-model="form.pledge_num" autoComplete="off" clearable  placeholder="请输入数字"></el-input>-->
<!--					</el-form-item>-->
<!--				</el-col>-->
<!--			</el-row>-->
		</el-tab-pane>
		<el-tab-pane style="padding-top:10px"  label="币种兑换" name="币种兑换">
			<el-row >
				<el-col :span="24">
					<el-form-item label="USDT兑美金" prop="usdt_exchange">
						<el-input type="number" v-model="form.usdt_exchange" autoComplete="off" clearable  placeholder="请输入比例"></el-input>
						<small style="color: rgb(192, 196, 204);">兑换比例 N : 1美金</small>
					</el-form-item>
				</el-col>
			</el-row>
		</el-tab-pane>
		<el-tab-pane v-if="address" style="padding-top:10px;"  label="钱包设置" name="钱包设置">
			<el-row >
				<el-col :span="24">
					<el-form-item label="账号分配类型" prop="address_tyoe">
						<el-radio-group v-model="form.address_tyoe">
							<el-radio :label="'1'">ECP20与TRC20</el-radio>
							<el-radio :label="'2'">ECP20</el-radio>
							<el-radio :label="'3'">TRC20</el-radio>
						</el-radio-group>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row >
				<el-col :span="24">
					<el-form-item label="钱包前缀" prop="address_prefix">
						<el-input v-model="form.address_prefix" autoComplete="off" clearable  placeholder="请输入钱包地址前缀"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row >
				<el-col :span="24">
					<el-form-item label="钱包地址长度" prop="wallet_address_length">
						<el-input type="number" v-model="form.wallet_address_length" autoComplete="off" clearable  placeholder="请输入钱包地址长度"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row >
				<el-col :span="24">
					<el-form-item label="TRC20充值地址" prop="usdt_address">
						<el-input v-model="form.usdt_address" autoComplete="off" clearable  placeholder="请输入钱包地址"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row >
				<el-col :span="24">
					<el-form-item label="BEP充值地址" prop="bep_usdt_address">
						<el-input v-model="form.bep_usdt_address" autoComplete="off" clearable  placeholder="请输入钱包地址"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
		</el-tab-pane>
		<el-tab-pane style="padding-top:10px;display: none;"  label="其他设置" name="其他设置">
			<el-row >
				<el-col :span="12">
					<el-form-item label="用户邀请码:" prop="member_code">
						<el-select style="width:100%" v-model="form.member_code" filterable clearable placeholder="请选择用户邀请码方式">
							<el-option key="0" label="邀请码" :value="'1'"></el-option>
							<el-option key="1" label="钱包地址" :value="'2'"></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="24">
					<el-form-item label="安卓下载地址" prop="download_apk">
						<el-input v-model="form.download_apk" autoComplete="off" clearable  placeholder="请输入安卓下载地址"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="24">
					<el-form-item label="IOS下载地址" prop="download_ios">
						<el-input v-model="form.download_ios" autoComplete="off" clearable  placeholder="请输入IOS下载地址"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="24">
					<el-form-item label="版本号" prop="version">
						<el-input v-model="form.version" autoComplete="off" clearable  placeholder="请输入版本号"></el-input>
					</el-form-item>
				</el-col>
			</el-row>

		</el-tab-pane>
	</el-tabs>
		<el-form-item>
			<el-button size="small" type="primary" @click="submit">保存设置</el-button>
		</el-form-item>
	</el-form>
</el-card>
</div>
{/block}
{block name="script"}
<script src="__PUBLIC__/assets/js/app.js"></script>
<script>
new Vue({
	el: '#app',
	components:{
	},
	data(){
		return {
			form: {
				site_title:'',
				logo:'',
				keyword:[],
				system_mailbox:'',
				descrip:'',
				copyright:'',
				filesize:'0',
				filetype:'',
				water_status:1,
				member_code:1,
				domain:'',
				usdt_exchange:1,
				adc_exchange:10,
				bonus_multiple:'',
				bonus_indirect:'',
				participate_multiple:'',
				participate_num:'',
				static_release:'',
				dynamic_release:'',
                mining_destruction:0,
				mining_daily_production:1000,
				mining_production_frequency:144,
				pledge_return:100,
				team_range_status:1,
				article_ecology:'',
				article_game:'',
				article_aboutmmst:'',
				article_contactus:'',
				matrix_introduction:'',
				download_apk:'',
				download_ios:'',
				version:'',
				gj_address:'',
				withdrawal_money_type:1,
				accounts_withdrawal_type:1,
				adc_accounts_withdrawal:'',
				adc_destroy:0,
				address_prefix:'',
				wallet_address_length:'',
				address_tyoe:1,
				register_cid:0,
				pledge_release_cid:0,
				register_num:0,
				direct_reward:0,
				direct_reward_cid:0,
				direct_reward_num:'',
				bep_usdt_address:'',
			},
			currency:[],
			show:true,
			loading:false,
			is_clear:false,
			files:false,
			isShow:false,
			address:false,
			activeName:'基本信息',
			rules: {
			}
		}
	},
	mounted(){
		axios.post(base_url + '/Currency/available_currency').then(res => {
			if(res.data.status == 200){
				this.currency = res.data.data
				this.form.vals = [];
				this.currency.unshift({id:0,name:'无代币奖励'});
				this.currency.forEach(item=>{
					this.form.vals.push({id:item.id,name:item.name})
				})
			}
		})
		axios.post(base_url + '/Baseconfig/getInfo').then(res => {
			if(res.data.status == 200){
				this.form = JSON.stringify(res.data.data) == '[]' ? {} : res.data.data
				this.setDefaultVal('keyword')
			}
		})
	},
	methods: {
		submit(){
			this.$refs['form'].validate(valid => {
				if(valid) {
					this.loading = true
					axios.post(base_url + '/Baseconfig/index',this.form).then(res => {
						if(res.data.status == 200){
							this.$message({message: res.data.msg, type: 'success'})
						}else{
							this.loading = false
							this.$message.error(res.data.msg)
						}
					}).catch(()=>{
						this.loading = false
					})
				}
			})
		},
		setDefaultVal(key){
			if(this.form[key] == null || this.form[key] == ''){
				this.form[key] = []
			}
		},
	}
})
</script>
{/block}
